import request from '@/utils/request'

export function getListApi(params) {
  return request({
    url: '/parking/card/list',
    params // 查询参数
  })
}

/**
 * 新增月卡
 * @data
 * @returns
 */
// export const createCardAPI = (data) => request({
//   url: '/parking/card',
//   method: 'POST',
//   data
// })

export function createCardAPI(data) {
  return request({
    url: '/parking/card',
    method: 'POST',
    data
  })
}

// 获取编辑页面月卡详情
export function getCardDetailAPI(id) {
  return request({
    url: `/parking/card/detail/${id}`
  })
}

// 编辑月卡
export function updateCardAPI(data) {
  return request({
    url: '/parking/card/edit',
    method: 'put',
    data
  })
}
// 删除月卡
export function delCardAPI(id) {
  return request({
    url: `/parking/card/${id}`,
    method: 'DELETE'
  })
}

/**
 * 批量删除月卡
 * @param {*} ids [1,2,3]
 * @returns
 */
export function delAllCardAPI(ids) {
  return request({
    url: `/parking/card/${ids.join(',')}`,
    method: 'DELETE'
  })
}

/**
 * 获取规则列表
 * @param { page, pageSize} params
 * @returns
 */
export function getRuleListAPI(params) {
  return request({
    url: 'parking/rule/list',
    params
  })
}
